package com.lottery.system.controller.param;

import com.fasterxml.jackson.annotation.JsonFormat;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

import java.io.Serializable;
import java.time.Instant;
import java.util.Date;
import java.util.List;

/**
 * @author: xiaoxie
 * create: 2024-09-11 09:13
 * @BelongsProject: lottery-system
 * @BelongsPackage: com.lottery.system.controller.param
 * description: 抽奖接口的参数
 */
@Data
public class DrawPrizeParam implements Serializable {

    /**
     *  活动id
     */
    @NotNull(message = "活动id不能为空!")
    private Long activityId;

    /**
     *  奖品id
     */
    @NotNull(message = "奖品id不能为空!")
    private Long prizeId;
    /**
     * 中奖时间
     */
    @NotNull(message = "中奖时间不能为空!")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
    private Date winningTime;

    /**
     * 中奖名单
     */
    @NotEmpty
    @Valid
    private List<Winner> winnerList;

    @Data
    public static class Winner{
        /**
         * 中奖者id
         */
        @NotNull(message = "中奖者id不能为空!")
        private Long userId;
        /**
         * 中奖者姓名
         */
        @NotBlank(message = "中奖者姓名不能为空!")
        private String userName;
    }
}
